class CommonNeighbor:

    def __init__(self, vertex1, vertex2, vertices):
        self.vertex = (vertex1.vertex, vertex2.vertex)
        self.value = 0
        self.calc_value(vertex1, vertex2)

    def __lt__(self, other):
        return self.value < other.value

    def calc_value(self, vertex1, vertex2):
        max_est = max(vertex1.sketch.est, vertex2.sketch.est)
        common = len(vertex1.sketch.sampling.intersection(vertex2.sketch.sampling))
        self.value = common / max_est
